package com.qfedu.fe.vo;

import com.qfedu.fe.config.SystemConfig;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * 作者:代福星
 * 特点:太帅了
 * 目标:敲代码永无Bug
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultVo<T> {
    private Integer code;
    private String msg;
    private T data;

    public static <T> ResultVo ok(T data){
        return new ResultVo(SystemConfig.R_OK,"操作成功",data);
    }

    public static ResultVo ok(){
        return ok(null);
    }

    public static ResultVo fail(Objects data){
        return new ResultVo(SystemConfig.R_FAIL,"操作失败",null);
    }
    public static ResultVo fail(){
        return fail(null);
    }
}
